import request from '@/utils/request'

// 获取权限列表
export function getPermissions() {
  return request({
    url: '/api/admin/permissions',
    method: 'get'
  })
}

// 根据ID获取权限
export function getPermissionById(permissionId) {
  return request({
    url: `/api/admin/permissions/${permissionId}`,
    method: 'get'
  })
}

// 创建权限
export function createPermission(data) {
  return request({
    url: '/api/admin/permissions',
    method: 'post',
    data
  })
}

// 更新权限
export function updatePermission(permissionId, data) {
  return request({
    url: `/api/admin/permissions/${permissionId}`,
    method: 'put',
    data
  })
}

// 删除权限
export function deletePermission(permissionId) {
  return request({
    url: `/api/admin/permissions/${permissionId}`,
    method: 'delete'
  })
}

// 获取API端点
export function getApiEndpoints() {
  return request({
    url: '/api/admin/api-endpoints',
    method: 'get'
  })
}